﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using MINERP.COM;
using System.Configuration;

namespace MINERP.AutoCutBoard
{
    static class Program
    {
        ///// <summary>
        ///// 应用程序的主入口点。
        ///// </summary>
        //[STAThread]
        //static void Main()
        //{
        //    Application.EnableVisualStyles();
        //    Application.SetCompatibleTextRenderingDefault(false);
        //    Application.Run(new FrmMain());
        //}
        static void Main()
        {
            //    Application.EnableVisualStyles();
            //    Application.SetCompatibleTextRenderingDefault(false);
            //    Application.Run(new FrmProductCondition());
            //}
            //UDPMessage.EncryptConfiguration();
            bool isAppRunning = false;
            System.Threading.Mutex mutex = new System.Threading.Mutex(
                true,
                "productcoditionmy",
                out isAppRunning);

            if (!isAppRunning)
            {
                MessageBox.Show("本程序已运行，请不要重复运行！");
                Environment.Exit(1);
            }
            else
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                Application.ApplicationExit += new EventHandler(MINERP.COM.UDPMessage.Application_ApplicationExit);

                //if (MINERP.COM.UDPMessage.ProcessReceiveMsg(false))
                //{
                    Application.Run(new FrmMain());
                //}
            }
        }
    }
}
